<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js对象</title>
</head>
<body>

</body>
<script>
    let arr = [1,2,3];
    console.log(arr);
    console.log(arr[0])
    console.log(arr[1])
    arr[10] = 100;
    console.log(arr[9])
    console.log(arr[8])
    console.log(arr);
    console.log(arr[9] = 90);
    console.log(arr[8] = "a");

    //3. 数组方法 - forEach , map, push , pop , unshift , shift , splice
    arr.forEach(function (item, index) {
        console.log(item, index);
    })

    arr.map(function (item, index) {
        console.log(item + 10, index);
    })

    arr.push(7, 8, 9);
    console.log(arr);

    arr.pop();
    console.log(arr);

    arr.unshift('a', 'b');
    console.log(arr);

    arr.shift();
    console.log(arr);

    arr.splice(1, 2, 'c', 'd');
    console.log(arr);
</script>
</html>